package lesson04;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class TetMain7 {

    public static void main(String[] args) {
//        2 > 1
//
//        CompareTo如果返回 0 就是相等  -1 是小于   1 是大于
//        (x < y) ? -1 : ((x == y) ? 0 : 1);
        Set<Student> set2 = new TreeSet<>();

        System.out.println("------------------------------");
        set2.add(new Student("afadsfas", 5));
        set2.add(new Student("jerry", 2));
        Student stu1 = new Student("mario", 3);
        Student stu2 = new Student("afadsfas", 3);
        set2.add(new Student("Tom", 1));
        set2.add(stu1);
        set2.add(stu2); // sno 去重
        System.out.println(set2.size());
        set2.forEach(System.out::println);
    }
}

